import EmberRouter from '@ember/routing/router';
import config from './config/environment';

const Router = EmberRouter.extend({
  location: config.locationType,
  rootURL: config.rootURL
});

Router.map(function() {
  this.route('scientists');
  this.route('about', { path: '/about' });
  this.route('favorites', { path: '/favs' });
  this.route('blog-post', { path: '/blog-post' });
  this.route('posts', function() {
    this.route('new');
    this.route('old');
    this.route('post', { path: '/post/:post_id' });
    this.route('favorite-posts')
  });

  //Specifying a Route's Model
  this.route('favorite-posts');


  this.route('not-found', { path: '/*path' });


  //loading substates
  this.route('slow-model');
  this.route('foo', function() {
    this.route('bar', function() {
      this.route('slow-model');
    });
  });
  //error substates
  this.route('articles', function() {
    this.route('overview');
  });

  this.route('photos', function(){
    this.route('photo', { path: '/:photo_id' }, function(){
      this.route('comments');
      this.route('comment', { path: '/comments/:comment_id' });
    });
  });

  this.route('secret')
  this.route('login');
});

export default Router;
